home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / tarsrc Folder / tar.h < prev    next >
Text File  |  1993-11-28  |  5KB  |  191 lines

  1. #ifndef USEDUMP
  2.  
  3. #include <Types.h>
  4. #include <Quickdraw.h>
  5. #include <Fonts.h>
  6. #include <OSEvents.h>
  7. #include <Controls.h>
  8. #include <Windows.h>
  9. #include <Menus.h>
  10. #include <TextEdit.h>
  11. #include <Dialogs.h>
  12. #include <Desk.h>
  13. #include <ToolUtils.h>
  14. #include <OSUtils.h>
  15. #include <Scrap.h>
  16. #include <Packages.h>
  17. #include <Lists.h>
  18. #include <Files.h>
  19. #include <Memory.h>
  20. #include <Printing.h>
  21. #include <Errors.h>
  22.  
  23. #ifndef EOF
  24. #define EOF    (-1L)
  25. #endif
  26.  
  27. #define DIRECTORY(pb)    (((pb).hFileInfo.ioFlAttrib & ioDirMask) == ioDirMask)
  28.  
  29. /*
  30.  * Character definitions
  31.  */
  32. #define ENTER    0x03
  33. #define BS    0x08
  34. #define TAB    0x09
  35. #define LF    0x0a
  36. #define    RETURN    0x0d
  37.  
  38. /*
  39.  * Difference between Mac and Unix times
  40.  */
  41. #define TIMEDIFF    0x7c25b080
  42.  
  43. /*
  44.  * Global Variables
  45.  */
  46. typedef struct {
  47.     int    unit;        /* SCSI ID for tape */
  48.     int    minTO;        /* Minimum timeout for any command (secs) */
  49.     int    motionTO;    /* Minimum timeout for tape motion (secs) */
  50.     int    rewindTO;    /* Rewind timeout (secs) */
  51.     Boolean    forceVariable;    /* Always run in variable block mode */
  52.     Boolean forceModeSelect; /* Always do a mode select */
  53.     int    densityCode;    /* Density code for mode select */
  54.     int    speed;        /* Speed code for mode select */
  55.     int    bufMode;    /* Buffered mode for mode select */
  56. } TapeVars;
  57.  
  58. extern struct pref {
  59.     Boolean        autoPage;    /* List by screenfulls */
  60.     Boolean        cvtNl;        /* Convert newline to return and back */
  61.     Boolean        dosCvt;        /* Convert DOS style newlines (extract only) */
  62.     Boolean        doPrint;    /* List to printer */
  63.     Boolean        floppy;        /* Use a floppy as the archive file */
  64.     Boolean        oldArch;    /* Old tar compatible */
  65.     int        blocking;    /* Size of each block, in records */
  66.     int        blockSize;    /* Size of each block, in bytes */
  67.     char        creator[4];    /* Finder Creator */
  68.     char        type[4];    /* Finder Type */
  69.     Boolean        doOverWrite;    /* Force overwrite of existing files */
  70.     Boolean        tape;        /* Use a tape drive as the archive file */
  71.     TapeVars    tapeVars;    /* Tape specific options */
  72. } pref;
  73.  
  74. extern Boolean    doneFlag;
  75. extern Boolean    menusOK;
  76. extern Boolean    pOpen;
  77.  
  78. extern char    header[];
  79.  
  80. extern THPrint    prRecHdl;
  81.  
  82. /*
  83.  * Standard File and GetDir saved outputs
  84.  */
  85. extern long    dirDirID;
  86. extern short    dirVRefNum;
  87.  
  88. /*
  89.  * External routines
  90.  */
  91. extern Boolean    CmdFile();
  92. extern Boolean    GetDir();
  93. extern Boolean    MenuInit();
  94. extern Boolean    PrSetup();
  95. extern Boolean    WindInit();
  96. extern Boolean    StopGoAlert(const char *);
  97. extern void    GenericAlert(const char *);
  98.  
  99. /*
  100.  * Remainder taken from:
  101.  * Header file for public domain tar (tape archive) program.
  102.  *
  103.  * @(#)tar.h 1.20 86/10/29    Public Domain.
  104.  *
  105.  * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
  106.  */
  107.  
  108. /*
  109.  * Header block on tape.
  110.  *
  111.  * I'm going to use traditional DP naming conventions here.
  112.  * A "block" is a big chunk of stuff that we do I/O on.
  113.  * A "record" is a piece of info that we care about.
  114.  * Typically many "record"s fit into a "block".
  115.  */
  116. #define    RECORDSIZE    512
  117. #define    NAMSIZ    100
  118. #define    TUNMLEN    32
  119. #define    TGNMLEN    32
  120.  
  121. union record {
  122.     char        charptr[RECORDSIZE];
  123.     struct header {
  124.         char    name[NAMSIZ];
  125.         char    mode[8];
  126.         char    uid[8];
  127.         char    gid[8];
  128.         char    size[12];
  129.         char    mtime[12];
  130.         char    chksum[8];
  131.         char    linkflag;
  132.         char    linkname[NAMSIZ];
  133.         char    magic[8];
  134.         char    uname[TUNMLEN];
  135.         char    gname[TGNMLEN];
  136.         char    devmajor[8];
  137.         char    devminor[8];
  138.     } header;
  139. };
  140.  
  141. /* The checksum field is filled with this while the checksum is computed. */
  142. #define    CHKBLANKS    "        "    /* 8 blanks, no null */
  143.  
  144. /* The magic field is filled with this if uname and gname are valid. */
  145. #define    TMAGIC        "ustar  "    /* 7 chars and a null */
  146.  
  147. /* The linkflag defines the type of file */
  148. #define    LF_OLDNORMAL    '\0'        /* Normal disk file, Unix compat */
  149. #define    LF_NORMAL    '0'        /* Normal disk file */
  150. #define    LF_LINK        '1'        /* Link to previously dumped file */
  151. #define    LF_SYMLINK    '2'        /* Symbolic link */
  152. #define    LF_CHR        '3'        /* Character special file */
  153. #define    LF_BLK        '4'        /* Block special file */
  154. #define    LF_DIR        '5'        /* Directory */
  155. #define    LF_FIFO        '6'        /* FIFO special file */
  156. #define    LF_CONTIG    '7'        /* Contiguous file */
  157. /* Further link types may be defined later. */
  158.  
  159. /*
  160.  * Global variables
  161.  */
  162. extern Boolean        reblock;
  163.  
  164. /*
  165.  * We now default to Unix Standard format rather than 4.2BSD tar format.
  166.  * The code can actually produce all three:
  167.  *    standard    ANSI standard
  168.  *    oldarch        V7
  169.  *    neither        4.2BSD
  170.  * but we don't bother, since 4.2BSD can read ANSI standard format anyway.
  171.  * The only advantage to the "neither" option is that we can cmp(1) our
  172.  * output to the output of 4.2BSD tar, for debugging.
  173.  */
  174. #define    standard    (!pref.oldArch)
  175.  
  176. extern short    archive;    /* File descriptor for archive file */
  177.  
  178. /*
  179.  * Declarations of functions available to the world.
  180.  */
  181. union record    *FindRec();
  182. void        UseRec();
  183. union record    *EndOfRecs();
  184. Boolean        OpenArchive();
  185.  
  186. #ifdef MAKEDUMP
  187. #pragma dump "hdrs.dmp"
  188. #endif
  189. #else
  190. #pragma load "hdrs.dmp"
  191. #endif